import java.util.Scanner;
import java.util.Stack;
/*
* 动态规划
* */
public class Solution {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine().trim();
            System.out.println(countSubstrings(s));
        }
    }

    public static int countSubstrings(String s) {
        int len = s.length();
        boolean[][] dp = new boolean[len + 1][len + 1];
        int res = len;
        for (int a = 0; a < len; a++) {
            int i = a - 1, j = a + 1;
            while (i >= 0 && j < len && s.charAt(i) == s.charAt(j)) {
                res++;
                i--;
                j++;
            }
            i = a;
            j = a + 1;
            while (i >= 0 && j < len && s.charAt(i) == s.charAt(j)) {
                res++;
                i--;
                j++;
            }

        }
        return res;
    }

}

/*
* 上面的方法不是动态规划
* 下面的才是动态规划
* :dp[x][y] 代表的是从x到y是回文子串
 * dp[x][y] = dp[x+1][y-1]是回文子串，并且a[x]==a[y]
 * 边界：把回文串长为0和回文串长为1
 * 搜索方向是：串长从0 ~ len-1*/



class Solution2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine().trim();
            System.out.println(countSubstrings(s));
        }
    }

    public static int countSubstrings(String s) {
        int len = s.length();
        boolean[][] dp = new boolean[len][len];
        int res = 0;
        for (int i = 0; i < len; i++/*串长度*/) {
            for (int j = 0/*串首*/; j + i /*串尾*/< len; j++) {
                if (i == 0/*边界*/) {
                    dp[j][j+i] = true;
                    res++;
                }else if (i == 1/*边界*/) {
                    if (s.charAt(j) == s.charAt(j+i)) {
                        dp[j][j+i] = true;
                        res++;
                    }
                }else {
                    if (dp[j+1][j+i-1] && s.charAt(j) == s.charAt(j+i)) {
                        dp[j][j+i] = true;
                        res++;
                    }
                }
            }
        }
        return res;
    }

}
